package com.takeoff.bluewhale.model;


public class Response {
	private Result result=Result.SUCCESS;
	private String msg;
	private Object data;

	private Response(Result result) {
		this(result, null);
	}

	private Response(Result result, Object data) {
		this.result = result;
		this.data = data;
		this.msg=result.getMsg();
	}

	public static Response success() {
		return new Response(Result.SUCCESS);
	}

	public static Response success(Object data) {
		return new Response(Result.SUCCESS, data);
	}

	public static Response failed() {
		return failed(Result.UNKNOWN_ERROR);
	}

	public static Response failed(Object data) {
		return failed(Result.UNKNOWN_ERROR, data);
	}

	public static Response failed(Result result) {
		return new Response(result);
	}

	public static Response failed(Result result, Object data) {
		return new Response(result, data);
	}

	public Object getData() {
		return data;
	}

	public Result getResult() {
		return result;
	}
	public String getMsg() {
		return msg;
	}
}